package com.cait.cait.dao;

import com.cait.cait.entity.MemberCategory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author Jirath
 * @date 2020/2/13
 * @description:
 */
@Repository
public interface MemberCategoryDao {
    /**
     * search category
     * @param memberId
     * @return category of member
     */
    @Select("SELECT member_category_id FROM member_category WHERE member_id=#{memberId}")
    Integer getCategory(int memberId);

    /**
     * add record of category and set it 0
     * @param memberCategory
     */
    @Insert("INSERT INTO member_category (member_id , member_category_id) VALUES (#{memberId},0 ")
    void addRecord(MemberCategory memberCategory);
}
